package cn.com.coding.system.service.impl;

import cn.com.coding.common.utils.PageUtil;
import cn.com.coding.common.utils.Query;
import cn.com.coding.system.dao.UserCollectDao;
import cn.com.coding.system.domin.UserCollectEntity;
import cn.com.coding.system.domin.dto.UserCollectDto;
import cn.com.coding.system.service.UserCollectService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.Set;

/**
 * 用户收藏
 *
 * @author mxz * @email codingce@gmail.com
 * @date 2021-07-08 21:25:22
 */
@Service("userCollectService")
public class UserCollectServiceImpl extends ServiceImpl<UserCollectDao, UserCollectEntity> implements UserCollectService {

    @Override
    public PageUtil queryPage(Map<String, Object> params) {
        IPage<UserCollectEntity> page = this.page(
                new Query<UserCollectEntity>().getPage(params),
                new QueryWrapper<UserCollectEntity>()
        );

        return new PageUtil(page);
    }

    @Override
    public Set<UserCollectDto> getUserCollectByUserPid(String userPid) {
        return this.baseMapper.getUserCollectByUserPid(userPid);
    }
}

